<template>
  <div class="tools-container">
    <!-- 页面标题 -->
    <div class="page-header">
      <i class="fas fa-tools" aria-hidden="true"></i>
      <h2>教学工具</h2>
      <p>使用以下工具辅助教学活动，提升教学效果</p>
    </div>

    <!-- 工具卡片区域 -->
    <div class="tools-grid">
      <!-- 词汇量测试工具 -->
      <div class="tool-card" @mouseenter="hoverTool('vocabTest')" @mouseleave="hoverTool(null)">
        <div class="card-icon" :class="{ 'hover': activeTool === 'vocabTest' }">
          <i class="fas fa-language" aria-hidden="true"></i>
        </div>
        <div class="card-content">
          <h3>词汇量测试</h3>
          <p>评估学生的词汇掌握程度，生成详细的词汇量分析报告</p>
          <div class="tool-features">
            <span class="feature-tag">多级别测试</span>
            <span class="feature-tag">自动评分</span>
            <span class="feature-tag">错题分析</span>
          </div>
        </div>
        <div class="card-actions">
          <el-button type="primary" size="small" @click="handleToolClick('vocabTest')">
            开始使用
            <i class="fas fa-arrow-right" aria-hidden="true"></i>
          </el-button>
        </div>
      </div>

      <!-- 单词听写工具 -->
      <div class="tool-card" @mouseenter="hoverTool('dictation')" @mouseleave="hoverTool(null)">
        <div class="card-icon" :class="{ 'hover': activeTool === 'dictation' }">
          <i class="fas fa-pencil-alt" aria-hidden="true"></i>
        </div>
        <div class="card-content">
          <h3>单词听写</h3>
          <p>创建自定义单词列表，播放单词发音，辅助学生进行听写练习</p>
          <div class="tool-features">
            <span class="feature-tag">语音播放</span>
            <span class="feature-tag">自定义列表</span>
            <span class="feature-tag">自动核对</span>
          </div>
        </div>
        <div class="card-actions">
          <el-button type="primary" size="small" @click="handleToolClick('dictation')">
            开始使用
            <i class="fas fa-arrow-right" aria-hidden="true"></i>
          </el-button>
        </div>
      </div>

      <!-- 预留工具卡片位置 -->
      <div class="tool-card placeholder-card">
        <div class="add-icon">
          <i class="fa-solid fa-face-surprise" aria-hidden="true"></i>
        </div>
        <p>更多教学工具即将上线，敬请期待</p>
        <el-button size="small" class="add-button" disabled>
          敬请期待
        </el-button>
      </div>
    </div>

    <!-- 使用指南 -->
    <div class="usage-guide">
      <div class="guide-header">
        <i class="fas fa-lightbulb" aria-hidden="true"></i>
        <h3>工具使用指南</h3>
      </div>
      <div class="guide-content">
        <p>• 选择合适的教学工具，点击"开始使用"按钮进入工具界面</p>
        <p>• 所有工具支持生成学习报告，可导出分享给学生或家长</p>
        <p>• 工具数据将自动同步到学生档案，帮助跟踪学习进度</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'TeachingTools',
  data() {
    return {
      activeTool: null
    }
  },
  methods: {
    hoverTool(toolName) {
      this.activeTool = toolName
    },
    handleToolClick(toolName) {
      switch (toolName) {
        case 'vocabTest':
          this.$router.push({ path: 'vocabularyTestHome'})
          break
        case 'dictation':
          this.$notify.info('正在打开单词听写工具...')
          // 实际项目中可添加路由跳转或工具初始化逻辑
          break
      }
    }
  }
}
</script>

<style scoped>
.tools-container {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* 页面标题 */
.page-header {
  margin-bottom: 30px;
  text-align: center;
  padding: 10px 0;
}

.page-header h2 {
  margin: 10px 0;
  font-size: 24px;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-header h2 i {
  margin-right: 10px;
  color: #0084ff;
}

.page-header p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

/* 工具卡片网格 */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

/* 工具卡片样式 */
.tool-card {
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(8, 8, 8, 0.15);
  padding: 25px;
  background-color: #fff;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}

.tool-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(8, 8, 8, 0.2);
}

.card-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background-color: #f0f7ff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  transition: background-color 0.3s ease;
}

.card-icon.hover {
  background-color: #e0ecff;
}

.card-icon i {
  font-size: 24px;
  color: #0084ff;
}

.card-content h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: #333;
  font-weight: 500;
}

.card-content p {
  margin: 0 0 15px 0;
  color: #666;
  font-size: 14px;
  line-height: 1.5;
}

/* 功能标签 */
.tool-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.feature-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  background-color: #f0f2f5;
  color: #555;
}

/* 卡片操作区 */
.card-actions {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}

.card-actions .el-button {
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 14px;
}

.card-actions .el-button i {
  margin-left: 6px;
  font-size: 14px;
}

/* 预留卡片样式 */
.placeholder-card {
  border: 2px dashed #e0e0e0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-color: #fafafa;
}

.add-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background-color: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.add-icon i {
  font-size: 24px;
  color: #999;
}

.placeholder-card h3 {
  margin: 0 0 10px 0;
  color: #666;
  font-size: 18px;
  font-weight: 500;
}

.placeholder-card p {
  margin: 0 0 20px 0;
  color: #999;
  font-size: 14px;
}

.add-button {
  background-color: #f5f5f5;
  color: #999;
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
}

/* 使用指南 */
.usage-guide {
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(8, 8, 8, 0.15);
  padding: 20px;
  background-color: #fff;
}

.guide-header {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
}

.guide-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: #333;
  display: flex;
  align-items: center;
}

.guide-header h3 i {
  margin-right: 8px;
  color: #0084ff;
}

.guide-content {
  padding-left: 5px;
}

.guide-content p {
  margin: 8px 0;
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}

.guide-content p:before {
  content: "•";
  color: #0084ff;
  font-weight: bold;
  display: inline-block;
  width: 1em;
  margin-left: -1em;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }

  .tool-card {
    padding: 20px;
  }
}
</style>
